
<%@ page contentType="text/html;charset=UTF-8" %>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="layout" content="main" />
    <title>Dodawanie operacji</title>
  </head>
  <body>
    <div class="nav">
			<span class="menuButton"><g:link class="list" action="list" id="${person?.id}">Historia konta</g:link></span>
            <span class="menuButton"><g:link class="list" controller="commitmentType" action="create">Nowy typ operacji</g:link></span>
		</div>

		<div class="body">
			<h1>Dodawanie operacji na koncie ${person}</h1>
			<g:if test="${flash.message}">
			<div class="message">${flash.message}</div>
			</g:if>
			<g:hasErrors bean="${commitment}">
			<div class="errors">
				<g:renderErrors bean="${commitment}" as="list" />
			</div>
			</g:hasErrors>
			<g:form action="save" method="post" >
                <input type="hidden" id="personid" name="personid" value="${person?.id}">
				<div class="dialog">
					<table>
						<tbody>

							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="commitmentTypeId">Typ:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:commitment,field:'commitmentTypeId','errors')}">
                                    <g:select name="commitmentTypeId"
                                    from="${CommitmentType.list()}"
                                    value="${commitment?.commitmentType?.id}"
                                    optionKey="id"
                                    id="commitmentTypeId"/>
                                </td>
                            </tr>

                            <tr class="prop">
								<td valign="top" class="name">
									<label for="value">Brykiety:</label>
								</td>
								<td valign="top" class="value ${hasErrors(bean:commitment,field:'value','errors')}">
									<input type="text" id="value" name="value" value="${commitment?.value?.encodeAsHTML()}"/>
								</td>
							</tr>

                            <tr class="prop">
								<td valign="top" class="name">
									<label for="description">Opis:</label>
								</td>
								<td valign="top" class="value ${hasErrors(bean:commitment,field:'description','errors')}">
									<textarea id="description" name="description">${commitment?.description?.encodeAsHTML()}</textarea>
								</td>
							</tr>

						</tbody>
					</table>
				</div>

				<div class="buttons">
					<span class="button"><input class="save" type="submit" value="Utwórz" /></span>
				</div>

			</g:form>

		</div>
  </body>
</html>
